package com.test.ll;

public class Count3Quit {
	public static void main(String[] args){
		boolean[] ary = new boolean[500];
		for(int i=0;i<500;i++){
			ary[i]=true;
		}
		
		int length=ary.length;
		System.out.println(length);
		int count=0;
		int index=0;
		
		while(length>1){
			if(ary[index]==true){
				count++;
				if(count==3){
					count=0;
					ary[index]=false;
					length--;
				}
			}
			
			index++;
			
			if(index==ary.length){
				index=0;
			}
		}
		for(int i=0;i<ary.length;i++){
			if(ary[i]==true){
				System.out.println(i);
			}
		}
	}

}
